//
//  DGCoreTextEditor.h
//  DGCoreTextView
//
//  Created by Jinxiao on 13-1-11.
//  Copyright (c) 2013年 debugeek. All rights reserved.
//

#import <CoreText/CoreText.h>
#import "NSMutableAttributedString+DGCoreText.h"

@class DGCoreTextPattern;
@class DGCoreTextPatternSetting;
@class DGCoreTextEditor;

@protocol DGCoreTextEditorDataSource <NSObject>

- (BOOL)coreTextEditor:(DGCoreTextEditor *)coreTextEditor shouldDisplayHighlightedForPattern:(DGCoreTextPattern *)pattern;

@end


@interface DGCoreTextEditor : NSObject

@property (readwrite, nonatomic, strong) NSMutableArray *patterns;

@property (readwrite, nonatomic, strong) NSMutableAttributedString *styledString;

@property (readwrite, nonatomic, weak) id<DGCoreTextEditorDataSource> dataSource;

@property (readwrite, nonatomic, strong) UIColor *defaultColor;
@property (readwrite, nonatomic, strong) UIFont *defaultFont;

@property (readwrite, nonatomic, assign) CTLineBreakMode lineBreakMode;

- (id)initWithString:(NSString *)string;

- (void)preprocessWithPatternSetting:(DGCoreTextPatternSetting *)patternSetting;

- (void)process;

- (CGSize)sizeThatFits:(CGSize)constrainedSize;

@end
